<?php
session_start();

require './includes/functions.php';

if (!isset($_SESSION['user'])) {
    redirect_to("../401.php");
}

require './includes/db.php';
require './includes/class.eyemysqladap.inc.php';
require './includes/class.eyedatagrid.inc.php';

// Load the database adapter
$db = new EyeMySQLAdap(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME);

// Load the datagrid class
$x = new EyeDataGrid($db);

// Set the query, select all rows from the people table
$x->setQuery("*", "and_sponsors", "id");

// Hide ID Column
$x->hideColumn('id');


// Show reset grid control
//$x->showReset();
// Add standard control
$x->addStandardControl(EyeDataGrid::STDCTRL_EDIT, "document.dg.action =encodeURI('act_sponsors.php?id=%id%&nom=%nom%&logo=%logo%&site=%site%'); document.forms['dg'].submit();");
$x->addStandardControl(EyeDataGrid::STDCTRL_DELETE, "document.dg.action =encodeURI('act_sponsors.php?id=%id%'); document.forms['dg'].submit();");

// Add create control
$x->showCreateButton("document.dg.action ='act_sponsors.php'; document.forms['dg'].submit();", EyeDataGrid::TYPE_ONCLICK, 'Ajouter');

// Show checkboxes
//$x->showCheckboxes();

$x->setColumnType("logo", EyeDataGrid::TYPE_IMAGE, "%logo%");
$x->setColumnType("site", EyeDataGrid::TYPE_HREF, "%site%");

// Show row numbers
$x->showRowNumber();

// Change the amount of results per page
$x->setResultsPerPage(5);

// Stop ordering
//$x->hideOrder();
//
// Allowing filters on columns
//$x->allowFilters();
//$x->isAjaxUsed();

$x->setColumnHeader("nom", "Organisation");

$x->setColumnHeader("site", "Site web");

$x->setColumnHeader("logo", "Logo");

//----------------------------------------------------------------------
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
    <head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW" />
        <!--

Base template (without user's data) checked by http://validator.w3.org : "This page is valid XHTML 1.0 Transitional"
        -->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
        <title>ISIMG Android</title>

        <link href="./css/table.css" rel="stylesheet" type="text/css" />

        <link rel="stylesheet" href="./css/style.css" type="text/css" media="screen" />
        <!--[if IE 6]><link rel="stylesheet" href="./css/style.ie6.css" type="text/css" media="screen" /><![endif]-->
        <!--[if IE 7]><link rel="stylesheet" href="./css/style.ie7.css" type="text/css" media="screen" /><![endif]-->

        <style>
            .henisarticle td
            {
                padding: 5px;
                border: solid 0px #616161;
                /*vertical-align: top;
                text-align: left;*/
            }

            .aligncenter img, .henisarticle .aligncenter img
            {
                display: inline;
                margin-top: 0;
                margin-bottom: 0;
                margin-right: 3px;
            }

            .preview
            {
                width:100px;
                border:solid 1px #dedede;
                padding:10px;
            }
        </style>

        <script type="text/javascript" src="./js/jquery.js"></script>
        <script type="text/javascript" src="./js/script.js"></script>
    </head>
    <body>
        <div id="henispage-background-glare">
            <div id="henispage-background-glare-image">
                <div id="henismain">
                    <div class="henisheader">
                        <div class="henisheader-center">
                            <div class="henisheader-jpeg"></div>
                        </div>
                        <div class="henisheader-wrapper">
                            <div class="henisheader-inner">
                                <div class="henisheaderobject"></div>
                                <div class="henislogo">
                                    <h1 id="name-text" class="henislogo-name"><a href="./index.php">Administration du site</a></h1>
                                    <h2 id="slogan-text" class="henislogo-text">ISIMG Android</h2>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="henisnav">
                        <div class="henisnav-l"></div>
                        <div class="henisnav-r"></div>
                        <div class="henisnav-wrapper">
                            <div class="henisnav-inner">
                                <ul class="henismenu">
                                    <li><a href="./index.php"><span class="l"> </span><span class="r"> </span><span class="t">Accueil</span></a></li>
                                    <li><a href="./adm_actualites.php"><span class="l"> </span><span class="r"> </span><span class="t">Actualités</span></a></li>
                                    <li><a href="./adm_sponsors.php" class="active"><span class="l"> </span><span class="r"> </span><span class="t">Sponsors</span></a></li>
                                    <li><a href="./adm_comite_pilotage.php"><span class="l"> </span><span class="r"> </span><span class="t">Comité de pilotage</span></a></li>
                                    <li><a href="./adm_comite_organisation.php"><span class="l"> </span><span class="r"> </span><span class="t">Comité d'organisation</span></a></li>
                                    <li><a href="./adm_participants.php"><span class="l"> </span><span class="r"> </span><span class="t">Participants</span></a></li>
                                    <li><a href="./adm-auth/act_authentification.php?action=logout"><span class="l"> </span><span class="r"> </span><span class="t">Déconnexion</span></a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="henissheet">
                        <div class="henissheet-tl"></div>
                        <div class="henissheet-tr"></div>
                        <div class="henissheet-bl"></div>
                        <div class="henissheet-br"></div>
                        <div class="henissheet-tc"></div>
                        <div class="henissheet-bc"></div>
                        <div class="henissheet-cl"></div>
                        <div class="henissheet-cr"></div>
                        <div class="henissheet-cc"></div>
                        <div class="henissheet-body">
                            <div class="heniscontent-layout">
                                <div class="heniscontent-layout-row">
                                    <div class="henislayout-cell heniscontent">
                                        <div class="henispost">
                                            <div class="henispost-tl"></div>
                                            <div class="henispost-tr"></div>
                                            <div class="henispost-bl"></div>
                                            <div class="henispost-br"></div>
                                            <div class="henispost-tc"></div>
                                            <div class="henispost-bc"></div>
                                            <div class="henispost-cl"></div>
                                            <div class="henispost-cr"></div>
                                            <div class="henispost-cc"></div>
                                            <div class="henispost-body">
                                                <div class="henispost-inner henisarticle">
                                                    <h2 class="henispostheader">Sponsors</h2>
                                                    <div class="henispostcontent">

                                                        <div class="aligncenter">
                                                            <?php
//                                                          Print the table
                                                            $x->printTable();
                                                             
                                                            ?>

                                                            <br />
                                                            <br />
                                                        </div>

                                                        <p><br /></p>

                                                    </div>
                                                    <div class="cleared"></div>
                                                </div>
                                                <div class="cleared"></div>
                                            </div>
                                        </div>
                                        <div class="cleared"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="cleared"></div>
                            <div class="cleared"></div>
                        </div>
                    </div>
                    <div class="henisfooter">
                        <div class="henisfooter-t"></div>
                        <div class="henisfooter-b"></div>
                        <div class="henisfooter-body">
                            <div class="henisfooter-text">
                                <div class="cleared"></div>
                                <p class="henispage-footer">Auteur : <a href="http://www.isimg.rnu.tn/fra/profil/heni_saber">henis</a>.</p>
                            </div>
                            <div class="cleared"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
